<div class="page-header">
	<h1>菜单管理</h1>
</div>
<form id="form_search" name="form_search" method="post" action="">
	<div class="operate panel panel-default">
		<div class="panel-body">
			<div class="pull-left" id="main-sub-menu">
				<?php include $mainSubMenu;?>
			</div>
			<div class="pull-right">
				<a onclick="save();"  class="btn btn-sm btn-primary">保存</a>
			</div>
		</div>
	</div>
</form>
<!-- 功能操作区域结束 -->
<!-- 列表显示区域  -->
<div class="row">
	<div class="col-sm-4 sub_left_menu">
		<div class="well">
			<ul class="tree_menu"></ul>
		</div>
	</div>
	<div class="col-sm-8 sub_content">
		<form action="<?php echo C('backend');?>index.php?c=menu&m=add" id="form_data" name="form_data" method="post" class="well form-horizontal clearfix">
			<input type="hidden" name="ajax" id="ajax" value="1">
			<input type="hidden" name="opmode" id="opmode" value="">
			<input type="hidden" name="dosubmit" value="1" />
			<input type="hidden" name="id" value="<?php echo $id;?>" />
			<input type="hidden" name="__token__" value="<?php echo $token;?>" />
			
			<div class="form-group col-xs-12">
				<label class="col-sm-4 control-label" for="name">名称*：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" id="name" name="name" check="require" msg="请输入名称" value="<?php echo $menu['name'];?>" />
				</div>
			</div>

			<div class="form-group col-xs-12">
				<label class="col-sm-4 control-label" for="alias">别名*：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" id="alias" name="alias" check="require" msg="请输入别名" value="<?php echo $menu['alias'];?>" />
				</div>
			</div>
			
			<div class="form-group col-xs-12">
				<label class="col-sm-4 control-label" for="parent_id">级别*：</label>
				<div class="col-sm-8">
					<select name="parent_id" id="parent_id" class="form-control">
						<?php foreach($parent_menu as $pmenu):?>
						<option value="<?php echo $pmenu['id']?>"><?php echo $pmenu['id'].' - '.$pmenu['title'];?></option>
						<?php endforeach;?>
					</select>
				</div>
			</div>
			
			<div class="form-group col-xs-12">
				<label class="col-sm-4 control-label" for="menu_type">类型*：</label>
				<div class="col-sm-8">
					<select name="menu_type" id="menu_type" class="form-control" onchange="showMenuType();">
						<?php foreach($menu_type as $mtype):?>
						<option data-id="<?php echo $mtype['id'];?>" value="<?php echo $mtype['id']?>"><?php echo $mtype['name'];?></option>
						<?php endforeach;?>
					</select>
				</div>
			</div>
			
			<div class="form-group col-xs-12 hidden menuTypeItems" id="mentType_2">
				<label class="col-sm-4 control-label" for="component_id">分类*：</label>
				<div class="col-sm-8">
					<?php foreach($categories as $val):?>
					<input type="checkbox" name="cid[]" value="<?php echo $val['id']?>" /><?php echo $val['name']?>
					<?php endforeach;?>
			</div>
			</div>
			
			<div class="form-group col-xs-12 hidden menuTypeItems" id="mentType_3">
				<label class="col-sm-4 control-label" for="component_id">组件*：</label>
				<div class="col-sm-8">
					<select name="component_id" id="component_id" class="form-control">
						<?php foreach($component as $val):?>
						<option value="<?php echo $val['id']?>"><?php echo $val['name'];?></option>
						<?php endforeach;?>
					</select>
				</div>
			</div>
			
			<div class="form-group col-xs-12 hidden menuTypeItems" id="mentType_4">
				<label class="col-sm-4 control-label" for="link">链接*：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" id="link" name="link" value="<?php echo $menu['link'];?>">
				</div>
			</div>

			<div class="form-group col-xs-12">
				<label class="col-sm-4 control-label" for="sort">排序：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" id="sort" name="sort" value="<?php echo $menu['sort'];?>">
				</div>
			</div>

			<div class="form-group col-xs-12">
				<label class="col-sm-4 control-label" for="status">状态*：</label>
				<div class="col-sm-8">
					<select name="status" id="status" class="form-control">
						<option value="1" <?php echo $menu['status'] ==1 ? 'selected="selected"' : '';?>>启用</option>
						<option value="0" <?php echo $menu['status'] ==0 ? 'selected="selected"' : '';?>>禁用</option>
					</select>
				</div>
			</div>

			<div class="form-group col-xs-12">
				<label class="col-sm-4 control-label" for="params" >参数：</label>
				<div class="col-sm-8" >
					<textarea class="form-control" name="params" id="params" rows="5" class="col-xs-12" ><?php echo $menu['params'];?></textarea>
				</div>
			</div>
		</form>
	</div>
</div>